<%@ page import="org.codehaus.groovy.grails.plugins.PluginManagerHolder"%>
<%@ page
	import="org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils"%>
<%@ page import="grails.plugins.springsecurity.SecurityConfigType"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><g:layoutTitle default='Security Management Console' /></title>

<%--<link rel="stylesheet" media="screen" href="${resource(dir:'css',file:'reset.css')}"/>--%>
<g:javascript library='jquery' plugin='jquery' />
<jqui:resources />

<link rel="stylesheet" media="screen"
	href="${resource(dir:'css/smoothness',file:'jquery-ui-1.8.2.custom.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" media="screen"
	href="${resource(dir:'css',file:'jquery.jgrowl.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" media="screen"
	href="${resource(dir:'css',file:'jquery.safari-checkbox.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" media="screen"
	href="${resource(dir:'css',file:'date_input.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" media="screen"
	href="${resource(dir:'css',file:'jquery.jdMenu.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" media="screen"
	href="${resource(dir:'css',file:'spring-security-ui.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" media="screen"
	href="${resource(dir:'css',file:'table.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" media="screen"
	href="${resource(dir:'css',file:'jquery.jdMenu.slate.css',plugin:'spring-security-ui')}" />
<link rel="stylesheet" href="${resource(dir:'css',file:'main.css')}" />
<link rel="shortcut icon"
	href="${resource(dir:'images',file:'favicon.ico')}" type="image/x-icon" />

<%-- tab icons --%>
<style>
.icon_role {
	background-image: url('${fam.icon(name: ' lock ')}');
}

.icon_users {
	background-image: url('${fam.icon(name: ' group ')}');
}

.icon_user {
	background-image: url('${fam.icon(name: ' user ')}');
}

.icon_error {
	background-image: url('${fam.icon(name: ' exclamation ')}');
}

.icon_info {
	background-image: url('${fam.icon(name: ' information ')}');
}

.icon,.ui-tabs .ui-tabs-nav li a.icon {
	background-repeat: no-repeat;
	padding-left: 24px;
	background-position: 4px center;
}
</style>

<link rel="shortcut icon"
	href="${resource(dir:'images',file:'favicon.ico')}" type="image/x-icon" />

<g:layoutHead />

</head>

<body>

	<div>

		<div>

			<ul class="jd_menu jd_menu_slate">
				<sec:ifAllGranted roles="ROLE_ADMIN">
				<!-- 
					<li><a class="accessible"><g:message
								code="spring.security.ui.menu.users" /></a>
						<ul>
							<li><g:link controller="user" action='search'>
									<g:message code="spring.security.ui.search" />
								</g:link></li>
							<li><g:link controller="user" action='create'>
									<g:message code="spring.security.ui.create" />
								</g:link></li>
						</ul></li>
				-->
					<%--					<li><a class="accessible"><g:message--%>
					<%--								code="spring.security.ui.menu.roles" /></a>--%>
					<%--						<ul>--%>
					<%--							<li><g:link controller="role" action='search'>--%>
					<%--									<g:message code="spring.security.ui.search" />--%>
					<%--								</g:link></li>--%>
					<%--							<li><g:link controller="role" action='create'>--%>
					<%--									<g:message code="spring.security.ui.create" />--%>
					<%--								</g:link></li>--%>
					<%--						</ul></li>--%>
					<%--					<g:if--%>
					<%--						test='${SpringSecurityUtils.securityConfig.securityConfigType == SecurityConfigType.Requestmap}'>--%>
					<%--						<li><a class="accessible"><g:message--%>
					<%--									code="spring.security.ui.menu.requestmaps" /></a>--%>
					<%--							<ul>--%>
					<%--								<li><g:link controller="requestmap" action='search'>--%>
					<%--										<g:message code="spring.security.ui.search" />--%>
					<%--									</g:link></li>--%>
					<%--								<li><g:link controller="requestmap" action='create'>--%>
					<%--										<g:message code="spring.security.ui.create" />--%>
					<%--									</g:link></li>--%>
					<%--							</ul></li>--%>
					<%--					</g:if>--%>
					<%--					<g:if--%>
					<%--						test='${SpringSecurityUtils.securityConfig.rememberMe.persistent}'>--%>
					<%--						<li><a class="accessible"><g:message--%>
					<%--									code="spring.security.ui.menu.persistentLogins" /></a>--%>
					<%--							<ul>--%>
					<%--								<li><g:link controller="persistentLogin" action='search'>--%>
					<%--										<g:message code="spring.security.ui.search" />--%>
					<%--									</g:link></li>--%>
					<%--							</ul></li>--%>
					<%--					</g:if>--%>
					<%--					<li><a class="accessible"><g:message--%>
					<%--								code="spring.security.ui.menu.registrationCode" /></a>--%>
					<%--						<ul>--%>
					<%--							<li><g:link controller="registrationCode" action='search'>--%>
					<%--									<g:message code="spring.security.ui.search" />--%>
					<%--								</g:link></li>--%>
					<%--						</ul></li>--%>
					<%--					<g:if--%>
					<%--						test="${PluginManagerHolder.pluginManager.hasGrailsPlugin('springSecurityAcl')}">--%>
					<%--						<li><a class="accessible"><g:message--%>
					<%--									code="spring.security.ui.menu.acl" /></a>--%>
					<%--							<ul>--%>
					<%--								<li><g:message code="spring.security.ui.menu.aclClass" />--%>
					<%--									&raquo;--%>
					<%--									<ul>--%>
					<%--										<li><g:link controller="aclClass" action='search'>--%>
					<%--												<g:message code="spring.security.ui.search" />--%>
					<%--											</g:link></li>--%>
					<%--										<li><g:link controller="aclClass" action='create'>--%>
					<%--												<g:message code="spring.security.ui.create" />--%>
					<%--											</g:link></li>--%>
					<%--									</ul></li>--%>
					<%--								<li><g:message code="spring.security.ui.menu.aclSid" />--%>
					<%--									&raquo;--%>
					<%--									<ul>--%>
					<%--										<li><g:link controller="aclSid" action='search'>--%>
					<%--												<g:message code="spring.security.ui.search" />--%>
					<%--											</g:link></li>--%>
					<%--										<li><g:link controller="aclSid" action='create'>--%>
					<%--												<g:message code="spring.security.ui.create" />--%>
					<%--											</g:link></li>--%>
					<%--									</ul></li>--%>
					<%--								<li><g:message--%>
					<%--										code="spring.security.ui.menu.aclObjectIdentity" /> &raquo;--%>
					<%--									<ul>--%>
					<%--										<li><g:link controller="aclObjectIdentity"--%>
					<%--												action='search'>--%>
					<%--												<g:message code="spring.security.ui.search" />--%>
					<%--											</g:link></li>--%>
					<%--										<li><g:link controller="aclObjectIdentity"--%>
					<%--												action='create'>--%>
					<%--												<g:message code="spring.security.ui.create" />--%>
					<%--											</g:link></li>--%>
					<%--									</ul></li>--%>
					<%--								<li><g:message code="spring.security.ui.menu.aclEntry" />--%>
					<%--									&raquo;--%>
					<%--									<ul>--%>
					<%--										<li><g:link controller="aclEntry" action='search'>--%>
					<%--												<g:message code="spring.security.ui.search" />--%>
					<%--											</g:link></li>--%>
					<%--										<li><g:link controller="aclEntry" action='create'>--%>
					<%--												<g:message code="spring.security.ui.create" />--%>
					<%--											</g:link></li>--%>
					<%--									</ul></li>--%>
					<%--							</ul></li>--%>
					<%--					</g:if>--%>

				</sec:ifAllGranted>
				<sec:ifAnyGranted roles="ROLE_ADMIN,ROLE_CDIMPRESA">
					<li><a class="accessible"><g:message code="Immobili" /></a>
						<ul>
							<li><g:link controller="immobile" action='create'>
									<g:message code="Crea" />
								</g:link></li>
							<li><g:link controller="immobile" action='list'>
									<g:message code="Cerca" />
								</g:link></li>
						</ul></li>
					<li><a class="accessible"><g:message
								code="Tipologia Immobile" /></a>
						<ul>
							<li><g:link controller="tipologiaImmobile" action='create'>
									<g:message code="Crea" />
								</g:link></li>
							<li><g:link controller="tipologiaImmobile" action='list'>
									<g:message code="Cerca" />
								</g:link></li>
						</ul></li>
					<li><a class="accessible"><g:message code="Agente" /></a>
						<ul>
							<li><g:link controller="agente" action='create'>
									<g:message code="Crea" />
								</g:link></li>
							<li><g:link controller="agente" action='list'>
									<g:message code="Cerca" />
								</g:link></li>
						</ul></li>
					<li><a class="accessible"><g:message code="Immagini" /></a>
						<ul>
							<li><g:link controller="immagine" action='create'>
									<g:message code="Crea" />
								</g:link></li>
							<li><g:link controller="immagine" action='list'>
									<g:message code="Cerca" />
								</g:link></li>
						</ul></li>
					<li>
					<li><a class="accessible"><g:message code="Contatti" /></a>
						<ul>
							<li><g:link controller="contatto" action='create'>
									<g:message code="Crea" />
								</g:link></li>
							<li><g:link controller="contatto" action='list'>
									<g:message code="Cerca" />
								</g:link></li>
						</ul></li>
						<li><a class="accessible"><g:message code="Opzioni Contatti" /></a>
						<ul>
							<li><g:link controller="contattoOpzioni" action='create'>
									<g:message code="Crea" />
								</g:link></li>
							<li><g:link controller="contattoOpzioni" action='list'>
									<g:message code="Cerca" />
								</g:link></li>
						</ul></li>
                                                <!-- MUTUI -->
                                                <li><a class="accessible"><g:message code="Mutui" /></a>
                                                  <ul>
                                                      <li><a class="accessible"><g:message code="Banche" /></a>
                                                        <ul>
                                                          <li><g:link controller="banca" action='create'>
									<g:message code="Crea Banca" />
								</g:link></li>
                                                          <li><g:link controller="banca" action='list'>
									<g:message code="Cerca Banca" />
								</g:link></li>
                                                        </ul>
                                                      </li>
                                                      <li><a class="accessible"><g:message code="Prodotti" /></a>
                                                        <ul>
                                                          <li><g:link controller="prodotto" action='create'>
									<g:message code="Crea Prodotto" />
								</g:link></li>
                                                          <li><g:link controller="prodotto" action='list'>
									<g:message code="Cerca Prodotto" />
								</g:link></li>
                                                           <li><a class="accessible"><g:message code="Tipo Tasso" /></a>
                                                            <ul>
                                                              <li><g:link controller="tipoTasso" action='create'>
                                                                            <g:message code="Crea Tipo Tasso" />
                                                                    </g:link></li>
                                                              <li><g:link controller="tipoTasso" action='list'>
                                                                            <g:message code="Cerca Tipo Tasso" />
                                                                    </g:link></li>
                                                            </ul>
                                                          </li>
                                                           <li><a class="accessible"><g:message code="Tipo Prodotto" /></a>
                                                            <ul>
                                                              <li><g:link controller="tipoProdotto" action='create'>
                                                                            <g:message code="Crea Tipo Prodotto" />
                                                                    </g:link></li>
                                                              <li><g:link controller="tipoProdotto" action='list'>
                                                                            <g:message code="Cerca Tipo Prodotto" />
                                                                    </g:link></li>
                                                            </ul>
                                                          </li>
                                                           <li><a class="accessible"><g:message code="Finalità" /></a>
                                                            <ul>
                                                              <li><g:link controller="finalita" action='create'>
                                                                            <g:message code="Crea Finalità" />
                                                                    </g:link></li>
                                                              <li><g:link controller="finalita" action='list'>
                                                                            <g:message code="Cerca Finalità" />
                                                                    </g:link></li>
                                                            </ul>
                                                          </li>
                                                        </ul>
                                                      </li>
                                                </ul>
                                              </li>
						<li><g:link controller="searchable">
							<g:message code="Cerca" />
						</g:link></li>

				</sec:ifAnyGranted>



			</ul>

			<div id='s2ui_header_body'>
				<span id='s2ui_login_link_container'> <nobr>
						<div id='loginLinkContainer'>
							<sec:ifLoggedIn>
				Loggato come <sec:username /> (<g:link controller='logout'>Logout</g:link>)
				</sec:ifLoggedIn>
							<sec:ifNotLoggedIn>
								<a href='#' id='loginLink'>Login</a>
							</sec:ifNotLoggedIn>

							<sec:ifSwitched>
								<a href='${request.contextPath}/j_spring_security_exit_user'>
									Riaccedi come <sec:switchedUserOriginalUsername />
								</a>
							</sec:ifSwitched>
						</div>
					</nobr>

				</span>
				<div id='s2ui_header_title'>
					<br /> Resuite Management Console <br /> <br /> <a href="${createLink(uri: '/')}"><img src="${resource(dir:'images',file:'logo.png')}" /></a>
				</div>


			</div>

		</div>

		<div id="s2ui_main">
			<div id="s2ui_content">
				<g:javascript src='jquery/jquery.jgrowl.js'
					plugin="spring-security-ui" />
				<g:javascript src='jquery/jquery.checkbox.js'
					plugin="spring-security-ui" />
				<g:javascript src='jquery/jquery.date_input.js'
					plugin="spring-security-ui" />
				<g:javascript src='jquery/jquery.positionBy.js'
					plugin="spring-security-ui" />
				<g:javascript src='jquery/jquery.bgiframe.js'
					plugin="spring-security-ui" />
				<g:javascript src='jquery/jquery.jdMenu.js'
					plugin="spring-security-ui" />
				<g:javascript src='jquery/jquery.dataTables.min.js'
					plugin="spring-security-ui" />
				<g:javascript src='spring-security-ui.js'
					plugin="spring-security-ui" />
				<g:layoutBody />
			</div>
		</div>

	</div>

	<g:render template='/includes/ajaxLogin' />

	<s2ui:showFlash />

</body>
</html>

